import request from '@/utils/request'

import {encodeParams} from '@/utils'

export function login(username, password) {
  return request({
    url: `/api/login?username=${username}&password=${password}&grant_type=password&client_id=4eoxAQmG3dZyEwp9aJmBR8BHUxyRHpRi&client_secret=vhzGUlK3cROaNQ1ZQ9bxZ70TvKYNUAptoBO05umsZE3zKYyGSNMwuN3NQjkrIVNY&project=S`,
    method: 'GET',
  })
}

//根据用户名获取用户
export function findUserByUsername(username) {
  return request({
    url: `/api/login/findUserByUsername/${username}`,
    method: 'GET'
  })
}

//重置密码
export function resetPassword(data) {
  return request({
    url: '/api/login/resetPassword/',
    method: 'POST',
    data
  })
}

//发送短信验证码
export function sendSms(data) {
  return request({
    url: '/api/login/sendSms/',
    method: 'POST',
    data
  })
}

//确认验证码
export function verifyCode(mobile, code) {
  return request({
    url: `/api/login/verifyCode/${mobile}/${code}`,
    method: 'GET'
  })
}

//根据用户获取菜单 接口地址 /adminUser/getCurrentUserMenus

export function getMenuList() {
  return request({
    url: '/api/adminUser/getCurrentUserMenus',
    method: 'GET'
  })
}

export default {
  login, findUserByUsername, resetPassword, sendSms, verifyCode, getMenuList
}

